#include "sync_memory_pool.h"
#include "memory_pool.h"
#include <stdio.h>
sync_memory_pool::sync_memory_pool(size_t cont)
{
	mem_pool_impl = new memory_pool;
	if (mem_pool_impl)
	{
		if (!mem_pool_impl ->create_pool(cont))
		{
			printf("errer : mem_pool_impl ->create_pool(cont)");
		}
	}else
	{
		printf("errer : new memory_pool");
	}
}

sync_memory_pool::~sync_memory_pool( void )
{
	if (mem_pool_impl)
		delete mem_pool_impl;
}

void* sync_memory_pool::m_malloc( size_t mem_size )
{
	CCriticalAutoLock loAutoLock(m_poCriSectionMemPoll);
	if (mem_pool_impl)
		return mem_pool_impl->mem_malloc(mem_size);
	return 0;
}

void sync_memory_pool::m_free( void *mem_ptr )
{
	CCriticalAutoLock loAutoLock(m_poCriSectionMemPoll);
	if (mem_pool_impl)
		mem_pool_impl->mem_free(mem_ptr);
}

